import QtQuick 2.12
import QtQuick.Dialogs 1.3
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3

Dialog {
    title: "增加趋势线"
    width: 400
    height: 250
    property alias saveButton:saveButton
    property alias cancelButton:cancelButton
    property alias aInput:aInput
    property alias bInput:bInput
    property alias cInput:cInput
    property alias typeBox:cb1
    property alias text1:text1
    property alias xMin:xMin
    property alias xMax:xMax
    property alias model1:model1
    ColumnLayout  {
        anchors.centerIn: parent
        ComboBox {
            id:cb1
            width: 110
            height: 31
            textRole: "text";
            model: model1
            Layout.alignment: Qt.AlignCenter
        }
        RowLayout{
            Layout.alignment: Qt.AlignCenter
            Text {
                id:text1
                text: "y=ax+b:"
            }
            TextField {
                id: aInput
                placeholderText: "a"
                Layout.preferredWidth: 95
                selectByMouse: true
            }
            TextField {
                id: bInput
                placeholderText: "b"
                Layout.preferredWidth: 95
                selectByMouse: true
            }
            TextField {
                id: cInput
                placeholderText: "c"
                Layout.preferredWidth: 95
                selectByMouse: true
                visible: false
            }
        }
        RowLayout{
            Layout.alignment: Qt.AlignCenter
            Text {
                id:text2
                text: "输入x范围:"
            }
            TextField {
                id: xMin
                placeholderText: "Min"
                Layout.preferredWidth: 95
                text:"0"
                selectByMouse: true
            }
            TextField {
                id: xMax
                placeholderText: "Max"
                Layout.preferredWidth: 95
                selectByMouse: true
            }
        }
        RowLayout{
            Layout.topMargin:10
            Layout.alignment: Qt.AlignCenter
            Button {
                id:saveButton
                Layout.alignment: Qt.AlignCenter
                text: "保存"
            }
            Button {
                id:cancelButton
                Layout.alignment: Qt.AlignCenter
                text: "取消"
            }
        }
    }
    ListModel{
        id:model1
        ListElement{
            text:"线性";type:"y=ax+b:"
        }
        ListElement{
            text:"多项式";type:"y=ax*x+bx+c:"
        }
        ListElement{
            text:"指数";type:"y=a*exp(bx):"
        }
        ListElement{
            text:"对数";type:"y=a+blog(x):"
        }
    }
}
